Passed
Push — master ( 33dd36...c64a01 )
by René
03:33
created

start.js ➔ deletePoll   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 12
rs 9.4285
1
/** global: Clipboard */
2
$(document).ready(function () {
3
	var clipboard = new Clipboard('.copy-link');
0 ignored issues
show
Bug introduced by
Clipboard does not seem to be defined.
Loading history...
4
	clipboard.on('success', function (e) {
5
		var $input = $(e.trigger);
6
		$input.tooltip('hide')
7
			.attr('data-original-title', t('core', 'Copied!'))
8
			.tooltip('fixTitle')
9
			.tooltip({placement: 'bottom', trigger: 'manual'})
10
			.tooltip('show');
11
		_.delay(function () {
12
			$input.tooltip('hide');
13
			if (OC.Share.Social.Collection.size() === 0) {
14
				$input.attr('data-original-title', t('core', 'Copy'))
15
					.tooltip('fixTitle');
16
			} else {
17
				$input.tooltip('destroy');
18
			}
19
		}, 3000);
20
	});
21
	clipboard.on('error', function (e) {
22
		var $input = $(e.trigger);
23
		var actionMsg = '';
24
		if (/iPhone|iPad/i.test(navigator.userAgent)) {
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
25
			actionMsg = t('core', 'Not supported!');
26
		} else if (/Mac/i.test(navigator.userAgent)) {
27
			actionMsg = t('core', 'Press ⌘-C to copy.');
28
		} else {
29
			actionMsg = t('core', 'Press Ctrl-C to copy.');
30
		}
31
32
		$input.tooltip('hide')
33
			.attr('data-original-title', actionMsg)
34
			.tooltip('fixTitle')
35
			.tooltip({placement: 'bottom', trigger: 'manual'})
36
			.tooltip('show');
37
		_.delay(function () {
38
			$input.tooltip('hide');
39
			if (OC.Share.Social.Collection.size() == 0) {
0 ignored issues
show
Bug introduced by
=== was expected, but instead == was given.
Loading history...
40
				$input.attr('data-original-title', t('core', 'Copy'))
41
					.tooltip('fixTitle');
42
			} else {
43
				$input.tooltip("destroy");
44
			}
45
		}, 3000);
46
	});
47
48
	$('.alt-tooltip').tooltip();
49
50
	$('.delete-poll').click(function () {
51
		deletePoll(this);
0 ignored issues
show
Bug introduced by
deletePoll does not seem to be defined.
Loading history...
52
	});
53
54
	$('.table-body .avatardiv').each(function (i, obj) {
55
		$(obj).avatar(obj.title, 32);
56
	});
57
58
	$('.popupmenu').each(function () {
59
		OC.registerMenu($('#expand_' + $(this).attr('value')), $('#expanddiv_' + $(this).attr('value')) );
60
	});
61
62
	$('.copy_link').click(function () {
63
		window.prompt(t('polls','Copy to clipboard: Ctrl+C, Enter'), $(this).data('url'));
64
	});
65
});
66